package net.pws.oos.web.dto;

import javax.servlet.http.HttpServletRequest;

import net.pws.oos.biz.model.Indicator;

@SuppressWarnings("unchecked")
public class IndicatorTreeNodeDto extends AbstractTreeNode {

	public static IndicatorTreeNodeDto from(Indicator indicator,
			HttpServletRequest request) {
		IndicatorTreeNodeDto result = new IndicatorTreeNodeDto();
		result.metadata.put("id", indicator.getId());
		result.metadata.put("name", indicator.getName());
		result.metadata.put("code", indicator.getCode());
		result.metadata.put("type", "organ");
		result.setTitle(indicator.getShortName());
		result.data.put("icon", request.getContextPath() + "/images/organ.png");
		// if(indicator.isLeaf()) {
		// result.state = "leaf";
		// }
		return result;
	}

	public IndicatorTreeNodeDto() {
	}
}
